#include<stdio.h>

int flat(int year);
int main(void)
{
	int year,month,day,flag;
	scanf("%d-%d-%d",&year,&month,&day);
	
	if(month>2)
	{
		flag=flat(year);
		
		if(!flag)
		{
			switch(month)
			{
				case 3:
					printf("%d",day+59);break;
				case 4:
					printf("%d",day+90);break;
				case 5:
					printf("%d",day+120);break;
				case 6:
					printf("%d",day+151);break;
				case 7:
					printf("%d",day+181);break;
				case 8:
					printf("%d",day+212);break;
				case 9:
					printf("%d",day+243);break;
				case 10:
					printf("%d",day+273);break;
				case 11:
					printf("%d",day+304);break;
				case 12:
					printf("%d",day+334);
			}
		}
		else
		{
			switch(month)
			{
				case 3:
					printf("%d",day+60);break;
				case 4:
					printf("%d",day+91);break;
				case 5:
					printf("%d",day+121);break;
				case 6:
					printf("%d",day+152);break;
				case 7:
					printf("%d",day+182);break;
				case 8:
					printf("%d",day+213);break;
				case 9:
					printf("%d",day+244);break;
				case 10:
					printf("%d",day+274);break;
				case 11:
					printf("%d",day+305);break;
				case 12:
					printf("%d",day+335);
			}
		}
	}
	else if(month==2)
	{
		printf("%d",day+31);
	}
	else
	{
		printf("%d",day);
	}
	
	return 0;
}
int flat(int year)
{
	if(year%4==0&&year%100)
	{
		return 1;
	}
	else if(year%400==0)
	{
		return 1;
	}
	return 0;
}
